<?php
include_once( 'function.php' );
check_login();

$tag = v('tag');
if( $tag == '' ) $tag = 'index';

$tag_file = 'pages/' . md5( $tag ) . '.data.txt';


if( file_exists( $tag_file ) )
	$content = file_get_contents( $tag_file );
else
	$content = '';
	
include_once( 'ext/fckeditor/fckeditor.php' );

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<title><?php echo $tag; ?> - Riki</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta name="robots" content="noindex, nofollow">
		<link href="style.css" rel="stylesheet" type="text/css" />
	</head>
	<body>
		<h1> <?php echo $tag; ?> - Modify Page [<a href="javascript:history.back(1);void(0)">return</a>]</h1>
				<hr>
		<form action="save.php" method="post">
<?php
// Automatically calculates the editor base path based on the _samples directory.
// This is usefull only for these samples. A real application should use something like this:
// $oFCKeditor->BasePath = '/fckeditor/' ;	// '/fckeditor/' is the default value.
$sBasePath = 'ext/fckeditor/' ;

$oFCKeditor = new FCKeditor('Rikitext') ;
$oFCKeditor->BasePath	= $sBasePath ;
$oFCKeditor->Value		= $content ;
$oFCKeditor->Height = '400px';
$oFCKeditor->Create() ;
?>
			<br>
			<input type="hidden" name="tag" value="<?php echo $tag; ?>" />
			<p><input type="submit" value="Save" style="width:200px;height:40px" /> </p>
		</form>
	</body>
</html>